
function onlyNumbersDano(evt)
{

var keyPressed = (evt.which) ? evt.which : event.keyCode
return !(keyPressed > 31 && (keyPressed < 48 || keyPressed > 57));

}

function onlyCaracteres(evt)
{

var keyPressed = (evt.which) ? evt.which : event.keyCode
return !(keyPressed > 32 && (keyPressed < 65 || keyPressed > 90 && keyPressed < 97 || keyPressed > 122));

}

function ValorMonedas(evt,obj,intsize,deczize)
{

    var keycode;

    if (window.event) keycode = window.event.keyCode;
    else if (evt) keycode = evt.which;
    else return true; 
  var fieldval= (obj.value);
var dots = fieldval.split(".").length;

if(keycode == 46)
    {
if(dots > 1){

return false;
}else{

return true;
}
    }
    if(keycode == 8 || keycode == 9 || keycode == 46 || keycode == 13 ) // back space, tab, delete, enter 
    {
        return true;
    }          
    if((keycode>=32 && keycode <=45) || keycode==47   || (keycode>=58 && keycode<=127))
    {
         return false;
    }


//alert(jQuery(fieldval:contains('.').length));

 if(fieldval == "0" && keycode == 48 )
   return false;
   //alert(fieldval.indexOf(".") + ' - '+ fieldval.length);
 if(fieldval.indexOf(".") != -1)
  { 
  if(keycode == 46)
   return false;
   var splitfield = fieldval.split(".");


   //alert('Spilt -> '+ splitfield[1].length);
   if(splitfield[1].length >= deczize && keycode != 8 && keycode != 0 )
   return false;
  }
  else if(fieldval.length >= intsize && keycode != 46)
  {
    return false;
  } 
  else return true;   
}

function check_cedula( form )
{
  var cedula = form.cedula.value;
  array = cedula.split( "" );
  num = array.length;
  if ( num == 10 )
  {
    total = 0;
    digito = (array[9]*1);
    for( i=0; i < (num-1); i++ )
    {
      mult = 0;
      if ( ( i%2 ) != 0 ) {
        total = total + ( array[i] * 1 );
      }
      else
      {
        mult = array[i] * 2;
        if ( mult > 9 )
          total = total + ( mult - 9 );
        else
          total = total + mult;
      }
    }
    decena = total / 10;
    decena = Math.floor( decena );
    decena = ( decena + 1 ) * 10;
    final = ( decena - total );
    if ( ( final == 10 && digito == 0 ) || ( final == digito ) ) {
      //alert( "La c\xe9dula ES v\xe1lida!!!" );
      return true;
    }
    else
    {
      alert( "La c\xe9dula NO es v\xe1lida!!!" );
      return false;
    }
  }
  else
  {
    alert("La c\xe9dula no puede tener menos de 10 d\xedgitos");
    return false;
  }
}